package com.ruoyi.project.applet.controller;

import com.ruoyi.project.applet.service.IWechatPayNewServer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/back")
@Api("各类回调接口")
public class BackController {

    @Autowired
    IWechatPayNewServer wechatPayNewServer;

    @ApiOperation("支付回调")
    @PostMapping("/payment")
    public String backPayOrder(HttpServletRequest request, HttpServletResponse response) {
        return wechatPayNewServer.backPayOrder(request, response);
    }


    @ApiOperation("提现回调")
    @PostMapping("/take/payment")
    public String backRefundPayOrder(HttpServletRequest request, HttpServletResponse response) {
        return wechatPayNewServer.refundPayOrder(request, response);
    }

    @ApiOperation("退款回调")
    @PostMapping("/refund/payment")
    public String refundPay(HttpServletRequest request, HttpServletResponse response) {
        return  wechatPayNewServer.refundPay(request, response);
    }
}
